<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>编辑优惠券发放记录</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">
			$(function() {
				//初始化表单验证
				$("#inputForm").initValidform();
				
			});
			
			function getCount(){
				var mobile = $("#mobile").val();
				var couponId = $("#couponId").val();
				url = "${ctx}/qd/memberCoupon/getcount"
				$.post(url,{"mobile":mobile,"couponId":couponId},function(result){
					$("#countHint").html('该用户已有此优惠券:'+result+'张');
				},"text"
				);
			}
		</script>
	</head>
	
	<body class="mainbody">
		<form:form id="inputForm" modelAttribute="memberCoupon" action="${ctx}/qd/memberCoupon/grantSave" method="post" class="form-horizontal">
			<form:hidden path="id"/>
			<form:hidden id ="couponId" path="couponId"/>
			<!--内容-->
			<div id="floatHead" class="content-tab-wrap">
				<div class="content-tab">
					<div class="content-tab-ul-wrap">
						<ul>
							<li><a class="selected" href="javascript:;">发放优惠券</a></li>
						</ul>
					</div>
				</div>
			</div>
	
			<div class="tab-content">
				<dl>
					<dt>会员手机号</dt>
					<dd>
						<form:input id ="mobile" path="member.mobile" htmlEscape="false"  onblur="getCount();" maxlength="50" class="required" cssClass="input normal" datatype="/^\d+$/" nullmsg="请输入会员手机号" errormsg="请输入数字" sucmsg=" "/>
						<span class="Validform_checktip">*请输入会员手机号</span>
					</dd>
				</dl>
			</div>
			<!--/内容-->
	
			<!--工具栏-->
			<div class="page-footer">
				<p id="countHint" style="color: red">${message }</p>
				<div class="btn-wrap" align="center">
					<input type="submit" name="btnSubmit" value="确认发放" id="btnSubmit" class="btn yellow" /> 
				</div>
			</div>
			<!--/工具栏-->
		</form:form>
	</body>
</html>

